# -*- coding: utf-8 -*-
# @File    : set_log.py
# @Date    : 2021-11-26
# @Author  : Richard

import os
import time
import logging

logger = logging.getLogger(__name__)
logger.setLevel(level=logging.INFO)
handler = logging.FileHandler("D:\PycharmProjects\sqlRun\RunSqlToDm\logs\\run.log")
handler.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
logger.addHandler(handler)

def write_log(msg_info):
    """
    :param msg_info: 写入日志的信息
    :return: 返回写日志状态
    """
    try:
        logger.info(msg=msg_info)
    except Exception as Err:
        print("日志写入发生致命错误！，详细信:{0}".format(Err))
